﻿@using System.Data;
@model DTcms.Model.BaseModel
@{
    ViewBag.Title = "账户余额-" + Model.site.name;
    string templateskin = Model.templateskin;
    string action = Model.info["action"].ToString();
}
@section HeaderContent{

}
<!--当前位置-->
<div class="section">
    <div class="location">
        <span>当前位置：</span>
        <a href="@Html.linkurl("index")">首页</a> &gt;
        <a href="@Html.linkurl("usercenter", "index")">会员中心</a>
        <a href="@Html.linkurl("useramount", "list")">账户余额</a>
    </div>
</div>
<!--/当前位置-->

<div class="section clearfix">
    <!--页面左边-->
    @Html.Partial("_ucenter_nav")
    <!--/页面左边-->
    <!--页面左边-->
    <div class="right-auto">
        <div class="bg-wrap" style="min-height:765px;">
            @if (action == "recharge")
            {
                <!--账户充值-->
                <div class="sub-tit">
                    <a class="add" href="javascript:history.go(-1);"><i class="iconfont icon-reply"></i>返回</a>
                    <ul>
                        <li class="selected">
                            <a href="@Html.linkurl("useramount", "recharge")">账户充值</a>
                        </li>
                        <li>
                            <a href="@Html.linkurl("useramount", "log")">充值记录</a>
                        </li>
                        <li>
                            <a href="@Html.linkurl("useramount", "list")">收支明细</a>
                        </li>
                    </ul>
                </div>

                <form id="rechargeForm" name="rechargeForm" url="/api/lisence_ajax/user_amount_recharge" class="layui-form">
                    <input name="site_id" type="hidden" value="@Model.site.id" />
                    <div class="form-box">
                        <dl class="form-group">
                            <dt>账户余额：</dt>
                            <dd>
                                当前账户金额为：<b>￥@Model.userModel.amount</b> 元
                            </dd>
                        </dl>
                        <dl class="form-group">
                            <dt>充值金额：</dt>
                            <dd>
                                <input name="order_amount" id="order_amount" type="text" class="input code" onkeydown="return checkNumber(event);" datatype="n" nullmsg="请输入金额" sucmsg=" " /> 元
                            </dd>
                        </dl>
                        <dl class="form-group">
                            <dt>支付方式：</dt>
                            <dd>
                                @{
                                    DataTable payList = Html.get_payment_list(0, "type=1");
                                    foreach (DataRow dr in payList.Rows)
                                    {
                                        int dr__loop__id = payList.Rows.IndexOf(dr) + 1;
                                        <input type="radio" name="payment_id" value="@dr["id"]" title="@dr["title"]" @Html.Raw(dr__loop__id == payList.Rows.Count ? "datatype=\"*\" sucmsg=\" \"" : "") />
                                    }
                                }
                            </dd>
                        </dl>
                        <dl class="form-group">
                            <dd>
                                <input id="btnSubmit" name="btnSubmit" type="submit" value="确认充值" class="submit" />
                            </dd>
                        </dl>
                    </div>
                </form>
                <script type="text/javascript">
                    layui.use(['validform', 'jqueryform'], function () {
                        $("#rechargeForm").initValidform('#btnSubmit', 0);
                    });
                </script>
                <!--账户充值-->
            }
            else if (action == "log")
            {
                <!--充值记录-->
                <div class="sub-tit">
                    <a class="add" href="javascript:history.go(-1);"><i class="iconfont icon-reply"></i>返回</a>
                    <ul>
                        <li>
                            <a href="@Html.linkurl("useramount", "recharge")">账户充值</a>
                        </li>
                        <li class="selected">
                            <a href="@Html.linkurl("useramount", "log")">充值记录</a>
                        </li>
                        <li>
                            <a href="@Html.linkurl("useramount", "list")">收支明细</a>
                        </li>
                    </ul>
                </div>

                <div class="table-wrap">
                    <table class="layui-table" lay-data="{page:true, id:'ltable'}" lay-filter="ltable">
                        <thead>
                            <tr>
                                <th lay-data="{checkbox:true}"></th>
                                <th lay-data="{field:'add_time'}">充值时间</th>
                                <th lay-data="{field:'recharge_no'}">订单号</th>
                                <th lay-data="{field:'payment_id'}">支付方式</th>
                                <th lay-data="{field:'amount'}">金额</th>
                                <th lay-data="{field:'status',templet:'#status'}">状态</th>
                                <th lay-data="{templet: '#barDemo'}">操作</th>
                            </tr>
                        </thead>
                    </table>
                </div>
                <script type="text/html" id="barDemo">
                    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
                </script>
                <script type="text/html" id="status">
                    {{d.status>0?'已完成':'未完成'}}
                </script>
                <input id="turl" type="hidden" value="@Html.linkurl("useramount", "log")" /><!--存在跳转的URL值-->
                <script type="text/javascript">
                    layui.use(['table', 'myaspx'], function () {
                        var table = layui.table, os = layui.myaspx;

                        // 渲染表格
                        os.dataBind('/api/lisence_ajax/get_user_recharge_list');

                        //监听行工具事件
                        table.on('tool(ltable)', function (obj) {
                            var data = obj.data;
                            if (obj.event === 'del') {
                                layer.confirm('确认操作吗？', function (index) {
                                    cmswh.request("user_address_delete", "POST", { checkId: data.id });
                                    obj.del();
                                    layer.close(index);
                                });
                            }
                        });
                    });
                </script>
                <!--/充值记录-->
            }
            else if (action == "list")
            {
                <!--收支明细-->
                <div class="sub-tit">
                    <a class="add" href="javascript:history.go(-1);"><i class="iconfont icon-reply"></i>返回</a>
                    <ul>
                        <li>
                            <a href="@Html.linkurl("useramount","recharge")">账户充值</a>
                        </li>
                        <li>
                            <a href="@Html.linkurl("useramount","log")">充值记录</a>
                        </li>
                        <li class="selected">
                            <a href="@Html.linkurl("useramount","list")">收支明细</a>
                        </li>
                    </ul>
                </div>

                <div class="table-wrap">
                    <table class="layui-table" lay-data="{page:true, id:'ltable'}" lay-filter="ltable">
                        <thead>
                            <tr>
                                <th lay-data="{checkbox:true}"></th>
                                <th lay-data="{field:'add_time'}">时间</th>
                                <th lay-data="{field:'remark'}">备注</th>
                                <th lay-data="{field:'value',templet:'#value'}">金额</th>
                                <th lay-data="{templet: '#barDemo'}">操作</th>
                            </tr>
                        </thead>
                    </table>
                    <script type="text/html" id="value">
                        {{d.value>0?'+':''}}
                        {{d.value}}
                    </script>
                    <script type="text/html" id="barDemo">
                        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
                    </script>
                </div>
                <input id="turl" type="hidden" value="@Html.linkurl("useramount","list")" /><!--存在跳转的URL值-->
                <script type="text/javascript">
                    layui.use(['table', 'myaspx'], function () {
                        var table = layui.table, os = layui.myaspx;

                        // 渲染表格
                        os.dataBind('/api/lisence_ajax/get_user_amount_list');

                        //监听行工具事件
                        table.on('tool(ltable)', function (obj) {
                            var data = obj.data;
                            if (obj.event === 'del') {
                                layer.confirm('确认操作吗？', function (index) {
                                    cmswh.request("user_amount_delete", "POST", { checkId: data.id });
                                    obj.del();
                                    layer.close(index);
                                });
                            }
                        });
                    });
                </script>
                <!--收支明细-->
            }
        </div>
    </div>
    <!--/页面左边-->
</div>
@section Scripts{

}